﻿
Imports System.Windows.Forms

Friend MustInherit Class ListViewVirtualMode
    Protected WithEvents ListView As ListView
    Protected ListViewItem As List(Of ListViewItem)

    Protected MustOverride Sub _Add(ByVal ListViewItem As ListViewItem)
    Protected MustOverride Sub _UpDataGUI()

    Protected Sub New(ByVal ListView As ListView, ByVal ListViewItem As List(Of ListViewItem))
        Me.ListView = ListView
        Me.ListViewItem = ListViewItem
    End Sub


    Friend Sub Add(ByVal ListViewItem As ListViewItem)
        Dim re As IAsyncResult
        If ListView.InvokeRequired Then
            re = ListView.BeginInvoke(New AddDelegate(AddressOf _Add), {ListViewItem})
            ListView.EndInvoke(re)
        Else
            _Add(ListViewItem)
        End If
    End Sub
    Friend Sub UpDataGUI()
        Dim re As IAsyncResult
        If ListView.InvokeRequired Then
            re = ListView.BeginInvoke(New UpDataGUIDelegate(AddressOf _UpDataGUI))
            ListView.EndInvoke(re)
        Else
            _UpDataGUI()
        End If
    End Sub


















End Class
